const Router = require('koa-router');
const labelRouer = new Router({prefix: '/label'});

const {
    create,
    getLabels,
    update
} = require('../controller/label.controller');

const { 
    verifyAuth, 
    verifyPermission,
} = require('../middleware/auth.middleware');

const {
    verifyLabelExists
} = require('../middleware/label.middleware');
/**
 * 功能：创建标签
 */
labelRouer.post('/', verifyAuth, create);

/**
 * 从数据库中的标签表里获取已经有的标签
 */
labelRouer.get('/', verifyAuth, getLabels);

/**
 * 修改用户某一条动态的标签
 */
labelRouer.patch('/:momentId', verifyAuth, verifyPermission, verifyLabelExists, update);

module.exports = labelRouer;